package com.ruoyi.safe.task;

import com.ruoyi.safe.constant.SafeJobConstants;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Auther: lihongming
 * @Date: 2023-11-11 10:06
 * @Description: com.ruoyi.safe.task
 * @Version: 1.0
 */
@Component
@Slf4j
public class XxlJobTest {

    @XxlJob(value = SafeJobConstants.JOB_MY_TEXT)
    public ReturnT<String> executeJob() {
        String param = XxlJobHelper.getJobParam();
        log.info("executeJob定时任务调度成功,{}", param);
        try {
        } catch (Exception e) {
            log.error("===== 调度发生的的异常为：{}", e.getMessage());
            return ReturnT.FAIL;
        }
        if (true) {
            log.info("xxl-job测试任务执行结束。任务id：{}", param);
            return ReturnT.SUCCESS;
        } else {
            log.info("xxl-job测试任务执行失败。任务id：{}", param);
            return ReturnT.FAIL;
        }
    }
}
